package org.hcyspartnoc.demo.dao;

import org.hcyspartnoc.demo.entity.SpecificRequire;
import org.hcyspartnoc.demo.entity.SpecificTarget;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.neo4j.repository.query.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface SpecificTargetDao extends Neo4jRepository<SpecificTarget,Long> {


    @Query("MATCH (n) " +
            "where id(n) = $nodeId " +
            "CREATE (st:specificTarget {name: $name, number: $number, value: $value}) " +
            "MERGE (st)-[:属于]->(n)")
    void saveSpecificTargetNode(@Param("nodeId") Integer nodeId,
                                 @Param("name") String name,
                                 @Param("number") String number,
                                 @Param("value") String value);
}
